home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 7 / Eagles_Nest_Mac_Collection_Disc_7.TOAST / Needs [K] / DW550cPS#2 / Install 2.image / Server Support / hpdw550c.ps < prev    next >
Text File  |  1993-06-22  |  6KB  |  207 lines

  1. %
  2. % This file defines the PostScript ProcSet resource /HPDW550C which currently contains the
  3. % routine InstallDWRender and the definition of the transfer function procedure.  
  4. %
  5. /HPDW550C <<
  6. %
  7. % Routine:    InstallDWRender
  8. %
  9. % Input:    ProcessColorModel
  10. %                            This is the device color model that CPSI is currently
  11. %                            instantiated with.
  12. %
  13. %             MediaType        This is the type of paper chosen in by the user from the
  14. %                            print menu.  Possible types are:
  15. %
  16. %                                plainpaper (default)
  17. %                                hpspecialpaper
  18. %                                hpglossypaper
  19. %                                transparency
  20. %
  21. % Output:    None            Upon return from the routine the appropriate color rendering
  22. %                            dictionary, halftone and transfer functions will have been
  23. %                            loaded, depending upon the media type and color model.  Some of the 
  24. %                            media types and color models will probably use the same dictionaries, 
  25. %                            halftones, etc.  This will be determined as we go along by the 
  26. %                            quality of the output.
  27. %
  28. % Description:                This routine uses the color model and media type strings to obtain
  29. %                            a procedure that will load the appropriate graphics parameters.
  30. %                            It does this by using the media type string (it is on top of the
  31. %                            stack when this routine is entered) as a key into a dictionary who's
  32. %                            keys are all the possible media types, and the dictionary values are
  33. %                            another dictionary.  There is a dictionary for each media type and
  34. %                            each of those dictionaries have 3 keys, which are the color model
  35. %                            types.  The color model string is then used to index into the dictionary
  36. %                            and return a procedure, which is then executed.  The procedure contains
  37. %                            code to load the appropriate graphics parameters.
  38. %
  39. % History:    12/01/93    KM    Created.
  40. %
  41. /InstallDWRender
  42. {
  43.  
  44. % on stack -- colormodel, media type  (media type on top)
  45.  
  46. % IF (the media type and colormodel on the stack are different than the
  47. % currentmedia and currentcolormodel keys) THEN
  48. %        load in new graphics parameters
  49. % ELSE
  50. %        leave the graphics parameters as is
  51. %
  52.     dup                            
  53.     null ne
  54.     { dup } 
  55.     { pop (plainpaper) dup }     % remove bad media type, replace with plainpaper
  56.     ifelse
  57.     HPMediaDict /currentmedia get    
  58.         ne                % compare currentmedia and new media        
  59.     2 index                        
  60.     HPMediaDict /currentcolormodel get    
  61.         ne                % compare currentcolormodel and new colormodel        
  62.     or                    % if either are different then load new graphics parameters        
  63.         {
  64.         % update the current values
  65.             HPMediaDict /currentmedia 2 index put
  66.             HPMediaDict /currentcolormodel 3 index put
  67.         % load the new graphics parameter values
  68.             HPMediaDict exch get        % get the paper type dictionary
  69.             exch get                    % get the colormodel 
  70.             exec                        % execute the procedure
  71.         }
  72.         {
  73.         pop pop            % remove media and colormodel from stack
  74.         }
  75.         ifelse
  76.  
  77. }  % end InstallDWRender
  78.  
  79. % Define transfer function routine in the ProcSet so it will be a resource too
  80. %
  81. % Routine:    DefaultTransfer
  82. %
  83. % Input:    color value        The interpreter passes the transfer function a color
  84. %                            value and it's job is to possibly alter the value to
  85. %                            compensate for non-linear differences between the color
  86. %                            as specified vs how the device can produce it.  Refer
  87. %                            to the "Red Book" for more info.
  88. %
  89. % Output:    adjusted color    A value from 0 to 1, may be the same as the input value.
  90. %
  91. % Description:                Currently, this routine is doing nothing.  Eventually it
  92. %                            should do gamma correction.
  93. %
  94. % History:    12/01/92    KM    Created. Didn't do anything originally.
  95. %            01/11/93    KM    Changed to use a look up table to determine the new value.
  96. %                            The table in the first release came from a book, this will 
  97. %                            be changed soon to a gamma correction measured from our
  98. %                            output.
  99. %            02/18/93    KM    Changed to use a table tuned from scanning some sample
  100. %                            output from printer, now dividing by 255 as samples range
  101. %                            from 0 to 255.
  102. %            04/15/93    KM    Changed to use a different array for color and black.
  103. %            05/19/93    KM    Not using a table anymore to find adjusted value, let PS
  104. %                            interpreter do the math (using base to the exponent power).
  105. %                            Also added different transfer functions for special paper and
  106. %                            different colormodels.
  107. /DefaultTransfer
  108. {    
  109.  
  110.     {
  111.         0.4 exp 
  112.     } 
  113.  
  114.     {
  115.         0.4 exp 
  116.     } 
  117.  
  118.     {
  119.         0.4 exp 
  120.     } 
  121.  
  122.     {
  123.         0.7 exp
  124.     }
  125.     setcolortransfer
  126.  
  127. }    % end DefaultTransfer
  128.  
  129. % Routine:    GrayTransfer
  130. %
  131. % Description:
  132. %            Grayscale value needs to be something different than CMYK.
  133. %
  134. /GrayTransfer
  135. {
  136.         {
  137.         0.6 exp
  138.         }
  139.         settransfer
  140. }  % end SpecialGrayTransfer
  141.  
  142. % Routine:    SpecialGrayTransfer
  143. %
  144. % Description:
  145. %            HP Special paper requires a different transfer function than
  146. %            plain paper.  This one is for DeviceGray
  147. %
  148. /SpecialGrayTransfer
  149. {
  150.         {
  151.         0.275 exp
  152.         }
  153.         settransfer
  154. }  % end SpecialGrayTransfer
  155.  
  156. % Routine:    SpecialTransfer
  157. %
  158. % Description:
  159. %            HP Special paper requires a different transfer function than
  160. %            plain paper.  This one is for DeviceCMY and DeviceCMYK
  161. %
  162. /SpecialTransfer
  163. {
  164.         {
  165.         0.275 exp 
  166.         }
  167.         {
  168.         0.275 exp 
  169.         }
  170.         {
  171.         0.275 exp 
  172.         }
  173.         {
  174.          0.275 exp
  175.         }
  176.         setcolortransfer
  177. } % end SpecialTransfer
  178.  
  179. %
  180. % Routine:     EmptyGrayTransfer
  181. %
  182. % Description:
  183. %            This sets the transfer function to be empty (i.e., don't muck
  184. %            with the values). 
  185. %
  186. /EmptyGrayTransfer
  187. {
  188.     {} settransfer
  189. }  % end EmptyGrayTransfer
  190.  
  191. %
  192. % Routine:     EmptyTransfer
  193. %
  194. % Description:
  195. %            This sets the transfer function to be empty (i.e., don't muck
  196. %            with the values).  Used for DeviceCMY and DeviceCMYK 
  197. %
  198. /EmptyTransfer
  199. {
  200.     {} {} {} {} setcolortransfer
  201. }  % end EmptyTransfer
  202.  
  203. >> /ProcSet defineresource
  204.